<extend name="Public/base"/>

<block name="style">
	
	<style type="text/css">
	.choosed{
		height: 83%;
	}
	
	.not-choosed{
		
		height: 83%;
	}
	.fl{
		float: left;
		margin:0 10px;
	}
	.well{
		background: #fff;
	}
	</style>
</block>

<block name="body">
<script type="text/css">
  .add{
       width:100px; 
      }
</script>

<script type="text/javascript" src="__STATIC__/uploadify/jquery.uploadify.min.js"></script>
    <div class="main-title cf">
        <h2>
            <if condition="ACTION_NAME eq 'add'">新增展会
                <else/>  编辑展会
            </if>
        </h2>
    </div>
    <!-- 表单 -->
    <div class="with-padding">
        <form id="form" action="{:U('save')}" method="post" class="form-horizontal">
            <div class="form-item cf">
                <label class="item-label">专利编号<span class="check-tips"></span></label>

                <div class="controls">
                    <input type="text" class="text input-large form-control form-input-width" name="number"
                           value="{$data.number}">
                </div>
            </div>
            <div class="form-item cf">
                <label class="item-label">专利名称<span class="check-tips"></span></label>

                <div class="controls">
                    <input type="text" class="text input-large form-control form-input-width" name="patent"
                           value="{$data.patent}">
                </div>
            </div>
            <div class="form-item cf">
                <label class="item-label">专利类型<span class="check-tips"></span></label>

                <div class="controls">
	                <label class="line-height-1 blue">
	                    <input name="type" value="实用新型" type="radio" >
	                    <span class="lbl"> 实用新型</span>
	                </label>

	                <label class="line-height-1 blue">
	                    <input name="type" value="发明专利" type="radio" >
	                    <span class="lbl"> 发明专利</span>
	                </label>
	                
	                <label class="line-height-1 blue">
	                    <input name="type" value="外观专利" type="radio">
	                    <span class="lbl"> 外观专利</span>
	                </label>
                </div>
            </div>
            
            <div class="form-item cf">
                <label class="item-label">法律状态<span class="check-tips"></span></label>

                <div class="controls">
	                <label class="line-height-1 blue">
	                    <input name="lstatus" value="实质审查" type="radio">
	                    <span class="lbl"> 实质审查</span>
	                </label>

	                <label class="line-height-1 blue">
	                    <input name="lstatus" value="等年登印" type="radio">
	                    <span class="lbl"> 等年登印</span>
	                </label>
	                
	                <label class="line-height-1 blue">
	                    <input name="lstatus" value="专利权维持" type="radio">
	                    <span class="lbl"> 专利权维持</span>
	                </label>
                </div>
            </div>
            <div class="form-item cf">
                <label class="item-label">上传图片<span class="check-tips"></span></label>
			<div class="controls">
               <div id="upload_single_image_" style="padding-bottom: 5px;">选择图片</div>
                  <input class="attach" type="hidden" name="" value="{$data.pic}"/>
               <div class="upload-img-box">
                   <div class="upload-pre-item popup-gallery">
				      <notempty name="data.pic">
						<div class="each">
							<a href="{$data.pic}" title="点击查看大图"><img src="{$data.pic}"></a>
							<div class="text-center opacity del_btn" ></div>
							<div onclick="admin_image.removeImage($(this),'+data.id+')"  class="text-center del_btn">删除</div>
						</div>
                    </notempty>           
                 </div>
               </div>
           </div>
        <script>
            $(function () {
                var uploader_= WebUploader.create({
                    // 选完文件后，是否自动上传。
                    auto: true,
                    // swf文件路径
                    swf: 'Uploader.swf',
                    // 文件接收服务端。
                    server: "{:U('File/uploadPicture',array('session_id'=>session_id()))}",
                    // 选择文件的按钮。可选。
                    // 内部根据当前运行是创建，可能是input元素，也可能是flash.
                    pick: '#upload_single_image_',
                    // 只允许选择图片文件
                    accept: {
                        title: 'Images',
                        extensions: 'gif,jpg,jpeg,bmp,png',
                        mimeTypes: 'image/*'
                    }
                });
                uploader_.on('fileQueued', function (file) {
                    uploader_.upload();
                });
                /*上传成功**/
                uploader_.on('uploadSuccess', function (file, data) {
                    if (data.status) {
                        $("[name='']").val(data.id);
                        $("[name='']").parent().find('.upload-pre-item').html(
                                '<input type="hidden" name="pic" value="'+ data.path+'"/><div class="each"><a href="'+ data.path+'" title="点击查看大图"><img src="'+ data.path+'"></a><div class="text-center opacity del_btn" ></div>' +
                                        '<div onclick="admin_image.removeImage($(this),'+data.id+')"  class="text-center del_btn">删除</div></div>'
                        );
                        uploader_.reset();
                    } else {
                        updateAlert(data.info);
                        setTimeout(function () {
                            $('#top-alert').find('button').click();
                            $(that).removeClass('disabled').prop('disabled', false);
                        }, 1500);
                    }
                });
            })
        </script> 
</div>
								
            <div class="form-item">
                <input type="hidden" name="id" value="{$data.id}"/>
                <button type="submit" class="btn submit-btn ajax-post" target-form="form-horizontal">{:L("_SURE_WITH_SPACE_")}</button>
                <button class="btn btn-return" onclick="javascript:history.back(-1);return false;">{:L("_RETURN_WITH_SPACE_")}</button>
            </div>
        </form>
    </div>

</block>

<block name="script">
    <script type="text/javascript" src="__STATIC__/uploadify/jquery.uploadify.min.js"></script>
    <script type="text/javascript" charset="utf-8">
    Think.setValue('type', {$data.type|default = 1});
    Think.setValue('lstates', {$data.lstates|default = 1});
        //导航高亮
        highlight_subnav('{:U('Patent/index')}');
    </script>
    
    <link type="text/css" rel="stylesheet" href="/duijie/Public/js/ext/magnific/magnific-popup.css"/>
    <script type="text/javascript" src="/duijie/Public/js/ext/magnific/jquery.magnific-popup.min.js"></script>

    <script type="text/javascript" charset="utf-8" src="/duijie/Public/js/ext/webuploader/js/webuploader.js"></script>
    <link href="/duijie/Public/js/ext/webuploader/css/webuploader.css" type="text/css" rel="stylesheet">


    <script>
        $(document).ready(function () {
            $('.popup-gallery').each(function () { // the containers for all your galleries
                $(this).magnificPopup({
                    delegate: 'a',
                    type: 'image',
                    tLoading: '正在载入 #%curr%...',
                    mainClass: 'mfp-img-mobile',
                    gallery: {
                        enabled: true,
                        navigateByImgClick: true,
                        preload: [0, 1] // Will preload 0 - before current, and 1 after the current image

                    },
                    image: {
                        tError: '<a href="%url%">图片 #%curr%</a> 无法被载入.',
                        titleSrc: function (item) {
                            /*           return item.el.attr('title') + '<small>by Marsel Van Oosten</small>';*/
                            return '';
                        },
                        verticalFit: true
                    }
                });
            });
                    });
    </script>
</block>
